package Pet.Management.repository;

import Pet.Management.domain.entity.CommunityPost;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

public interface CommunityPostRepository extends JpaRepository<CommunityPost, Long> {
    
    // 按标题模糊查询
    Page<CommunityPost> findByTitleContaining(String title, Pageable pageable);
    
    // 按作者名称模糊查询
    Page<CommunityPost> findByUserUsernameLike(String username, Pageable pageable);
    
    // 同时按标题和作者查询
    Page<CommunityPost> findByTitleContainingAndUserUsernameLike(String title, String username, Pageable pageable);
    
    // 查询未删除的帖子
    Page<CommunityPost> findByDelFlagFalse(Pageable pageable);
} 